<extend name="Public/base" />
<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>新增会员</h2>
    </div>
    <form action="{:U('CompanyUser/edit')}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">会员姓名<span class="check-tips">（请填员工真实姓名）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="name" value="{$data.name}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">员工号<span class="check-tips">（请添加员工号）</span></label>
            <div class="controls">
                <input type="text" name="worker_id" value="{$data.worker_id}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">会员手机号</label>
            <div class="controls">
                <input type="tel" class="text input-large" name="mobile" value="{$data.mobile}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">所在企业<span class="check-tips"></span></label>
            <div class="controls">

                <select name="company_id" style="min-width: 80px">
                        <option value="{$data.company_id}">{$data.company}</option>
                </select>

            </div>
        </div>

        <div class="form-item">
            <label class="item-label">所属部门<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="section" value="{$data.section}">
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">员工福利额度<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="fuli" value="{$data.fuli}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">头像<span class="check-tips"></span></label>
            <div class="controls">
                <div class="controls">
                    <input type="file" id="z_img1">
                    <input type="hidden" name="image" id="z_img_id1" value=""/>
                    <div class="upload-img-box">
                        <img src="{$data.image}" alt="" style="max-height: 120px">
                    </div>
                </div>
                <script type="text/javascript">
                    //上传图片
                    /* 初始化上传插件 */
                    $("#z_img1").uploadify({
                        "height"          : 30,
                        "swf"             : "/Public/static/uploadify/uploadify.swf",
                        "fileObjName"     : "download",
                        "buttonText"      : "上传图片",
                        "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                        "width"           : 120,
                        'removeTimeout'	  : 1,
                        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
                        "onUploadSuccess" : z_img_id1,
                        'onFallback' : function() {
                            alert('未检测到兼容版本的Flash.');
                        }
                    });
                    function z_img_id1(file, data){
                        var data = $.parseJSON(data);
                        var src = '';
                        if(data.status){
                            $("#z_img_id1").val(data.path);
                            src = data.url || '' + data.path
                            $("#z_img_id1").parent().find('.upload-img-box').html(
                                '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                            );
                        } else {
                            updateAlert(data.info);
                            setTimeout(function(){
                                $('#top-alert').find('button').click();
                                $(that).removeClass('disabled').prop('disabled',false);
                            },1500);
                        }
                    }
                </script>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">会员账户<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="login_user" value="{$data.login_user}" disabled="disabled">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">会员密码<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="login_pass" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">确认密码<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="repassword" value="">
            </div>
        </div>
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
        <input type="hidden" name="id" value="{$data.id}">
    </form>
</block>